import { getStorage } from "../utils/common";
import http from "../utils/request";

const clientType ={}

export const getDeviceIncomeList = (data: any) => {
  return http("/api/device/getDeviceIncomeList", data, "POST");
};

// 退款记录
export const getAccountChangeList = (data: any) => {
  return http("/api/user/getAccountChangeList", data, "POST");
};

interface DefaultRes {
  
}




// 查询商城订单详情 -- 会员中心订单
export function apiShoppingMallOrderDetail(params : { orderId : string }) : Promise<any> {
	return http('/api/auth/shopping/mall/order/v2/apiShoppingMallOrderDetail', params)
}

// 会员中心-订单列表-- order
export function vipGoodsOrderList(prams : any) : Promise<any> {
	return http('/api/auth/shopping/mall/order/v2/vipGoodsOrderList', prams, 'POST')
}
// 查询商家系统订单信息列表（用户）
export function apiListMerOrderInfo(params : any) : Promise<any> {
	return http('/api/auth/mer/goods/order/apiListMerOrderInfoV2', params, 'POST') as any
}
// 查询商家系统订单详情
export function apiMerOrderDetail(params : { merOrderId : string }) : Promise<any> {
	return http('/api/auth/mer/goods/order/apiMerOrderDetail', params) as any
}

// API使用——创建订单评论
export function createGoodsOrderComment(params : any) : Promise<any> {
	return http('/api/auth/mer/goods/order/comment/createGoodsOrderComment', params, 'POST') as any
}

// 折扣加油订单列表
export function getUserGoodsOrderApiList(params : any) : Promise<any> {
	return http('/api/auth/user/goods/order/getUserGoodsOrderApiList', params, 'POST')
}

// 折扣加油订单列表
export function getUserGoodsOrderApiDetail(params : { "id" : string }) : Promise<any> {
	return http('/api/auth/user/goods/order/getUserGoodsOrderApiDetail', params, 'POST')
}


// 会员中心-订单列表 -- 代驾订单
export function getEdaijiaList(params : any) : Promise<any> {
	return http('/api/auth/edaijia/order/getList', params, 'POST')
}

// API-New创建VIP商品交易订单
export function createVipGoodsOrder(params : CreateVipGoodsTradeOrderParams) : Promise<CreateVipGoodsTradeOrderRes> {
	return http('/api/auth/shopping/mall/order/v2/createVipGoodsOrder', params, 'POST') as any
}
// 门店商品订单创建
export function createGoodsOrder(params : CreateGoodsOrderParams) : Promise<CreateGoodsOrderRes> {
	return http('/api/auth/mer/goods/order/createGoodsOrder', params, 'POST') as any
}
// API-赠送VIP订单创建
export function createGivingVipGoodsOrder(params : CreateGivingVipGoodsOrderParams) : Promise<CreateGivingVipGoodsOrderRes> {
	return http('/api/auth/user/rechangeOrder/createGivingVipGoodsOrder', params, 'POST') as any
}

// 获取拉起支付参数 门店订单
export function getInfoForPayGood(params : { merOrderId : string, rechangeChannel : string, openId ?: string }) : Promise<CreateGoodsOrderRes> {
	return http('/api/auth/mer/goods/order/getInfoForPay', params) as any
}



// 获取拉起支付参数 vip订单
export function getInfoForPay(params : { orderId : string, payChannel : string, openId ?: string }) : Promise<CreateGoodsOrderRes> {
	return http('/api/auth/shopping/mall/order/v2/getInfoForPay', params) as any
}
// 获取拉起支付参数 赠送会员
export function getInfoForPayGive(params : { orderId : string, payChannel : string, openId ?: string }) : Promise<CreateGoodsOrderRes> {
	return http('/api/auth/user/rechangeOrder/getInfoForPay', params) as any
}

// 取消订单Vip
export function cancelOrderVip(orderId : string) : Promise<DefaultRes> {
	return http('/api/auth/shopping/mall/order/v2/cancelOrder', orderId, 'POST') as any
}

// 取消订单 门店服务
export function cancelOrderStore(orderId : string) : Promise<DefaultRes> {
	return http('/api/auth/mer/goods/order/cancelOrder', orderId, 'POST') as any
}
// 申请退款 门店服务
export function apiRefundStore(params : { orderId : string, refundReason ?: string }) : Promise<DefaultRes> {
	return http('/api/auth/mer/goods/order/apiRefund', params, 'POST') as any
}
// 确认收货 vip订单
export function confirmGoodsVip(orderId : string) : Promise<DefaultRes> {
	return http('/api/auth/shopping/mall/order/v2/confirmGoods', orderId, 'POST') as any
}
// 根据核销码查询商家系统订单详情
export function apiMerOrderDetailByQrCode(params : { qrCode : string }) : Promise<DefaultRes> {
	return http('/api/auth/mer/goods/order/apiMerOrderDetailByQrCode', params) as any
}
// 商品核销v2-带施工人
export function apiUse(params : {
	"builderUserId" ?: string,
	"builderUserName" ?: string,
	"merOrderId" : string
}) : Promise<DefaultRes> {
	return http('/api/auth/mer/goods/order/apiUseV2', params, 'POST') as any
}


// 获取支付类型
export function getPayConfigList() : Promise<GetOrderPayConfigListRes> {
	return http('/api/auth/pay/getPayConfigList', { clientType }) as any
}

// 充电订单
export function getOrderListLink() : Promise<DefaultRes> {
	return http('/api/auth/xjCharge/getOrderListLink') as any
}

// 获取订单支付方式 会员订单

export function getOrderPayConfigListVip(params : { orderId : string }) : Promise<GetOrderPayConfigListRes> {
	return http('/api/auth/shopping/mall/order/v2/getOrderPayConfigList', {...params, clientType}) as any
}

// 获取订单支付方式 商家订单

export function getOrderPayConfigListStore(params : { merOrderId : string }) : Promise<GetOrderPayConfigListRes> {
	return http('/api/auth/mer/goods/order/getOrderPayConfigList', {...params, clientType}) as any
}

// 获取订单支付方式 赠送会员

export function getOrderPayConfigListGive(params : { orderId : string }) : Promise<GetOrderPayConfigListRes> {
	return http('/api/auth/user/rechangeOrder/getOrderPayConfigList', {...params, clientType}) as any
}